<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员登录界面</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <style>
        *,
        body,
        html,
        ul,
        li {
            margin: 0;
            padding: 0;
            box-sizing: border-box;

        }
        ul,
        li {
            list-style: none;
            cursor:pointer;
        }

        .container {
            position: absolute;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #54307d;
            cursor:pointer;
            transform-style: preserve-3d;
            perspective: 800px;
        }

        .container .main {
            width: 500px;
            height: 500px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
            background: #4c317a;
            display: flex;
            justify-content: center;
            align-items: center;
            transform-style: preserve-3d;
            perspective: 800px;
            animation: mainplay 1s linear forwards;
        }
        @keyframes mainplay{
            from{transform: scale(0) rotate(360deg); opacity: 0;}
            to{transform: scale(1)  rotate(0deg); opacity: 1;}
        }
        .container .main .registerpage {
            width: 100%;
            height: 100%;
            position: absolute;
        }

        .container .main .bg {
            width: 100%;
            height: 100%;
            position: absolute;
            background: linear-gradient(#6c39c7, #65f0ffbd);
            z-index: -1;
            animation: clipplay 2s infinite alternate linear;
        }

        @keyframes clipplay {
            from {
                clip-path: polygon(20% 0%, 0% 20%, 9% 50%, 0% 80%, 20% 100%, 53% 93%, 80% 100%, 100% 80%, 89% 50%, 100% 20%, 80% 0%, 48% 13%);
            }

            to {
                clip-path: polygon(20% 0%, 0% 20%, 0 52%, 0% 80%, 20% 100%, 50% 100%, 80% 100%, 100% 80%, 100% 48%, 100% 20%, 80% 0%, 48% 0);
            }
        }

        .container .main .formone {
            width: 80%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            /* display: none; */
        }

        .container .main .formone div {
            width: 100%;
            flex: 1;
            text-align: center;
        }

        .container .main .formone .title {
            display: flex;
            justify-content: center;
            align-items: center;
            color: #6ad6c8f0;
            font-size: 40px;
        }

        .container .main .formone .username {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .container .main .formone input {
            width: 100%;
            height: 70%;
            line-height: 100%;
            border-radius: 5px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: transparent;
            color: white;
            outline: none;
            text-align: center;
            box-shadow: 0px 0px 2px 0px #6c569a;
        }

        ::-webkit-input-placeholder {
            /* WebKit browsers */
            color: white;
            font-size: 16px;
        }

        .container .main .formone input:hover {
            box-shadow: 0px 0px 20px 0px #4787d2;
        }

        .container .main .formone button {
            width: 100%;
            height: 70%;
            line-height: 100%;
            border-radius: 5px;
            border: none;
            background: #714cac;
            color: white;
            outline: none;
        }

        .container .main .formone .loginbtn,
        .container .main .formone .registerbtn {
            position: relative;
        }

        .btnbg {
            width: 0% !important;
            height: 70%;
            position: absolute;
            left: 50%;
            background: linear-gradient(#9756e2, #495a73);
            transition: all 1s;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            letter-spacing: 5px;
            border-radius: 5px;

        }

        .container .main .formone .registerbtn:hover .btnbg,
        .container .main .formone .loginbtn:hover .btnbg {
            width: 100% !important;
            left: 0%;
        }

        .container .main .registerpage {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            display: none;
        }

        .container .main .formtwo {
            width: 80%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
        }

        .container .main .formtwo>div {
            width: 100%;
            flex: 1;
            text-align: center;
        }

        .container .main .formtwo .registertitle {
            display: flex;
            justify-content: center;
            align-items: center;
            color: #6ad6c8f0;
            font-size: 40px;
        }

        .container .main .formtwo input {
            width: 100%;
            height: 60%;
            line-height: 100%;
            border-radius: 5px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: transparent;
            color: white;
            outline: none;
            text-align: center;
            margin-top: -30px;
            box-shadow: 0px 0px 2px 0px #6c569a;
        }
        .container .main .formtwo input:hover {
            box-shadow: 0px 0px 20px 0px #4787d2;
        }
        .container .main .formtwo .btn_list{
            width: 100%;
            display: flex;
            justify-content: center;
        }
        .container .main .formtwo .btn_list>div{
            width: 100%;
        }
        .container .main .formtwo .btn_list button{
            width: 80%;
            height: 35%;
            background: transparent;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 5px;
            outline: none;
        }
        .container .main .formtwo .btn_list button:hover{
            background: #5278cafc;
        }

    </style>
    <script src="/layui/layui.js"></script>
</head>
<body>
<div class="container">
    <div class="main">
        <div class="bg"></div>

        <form class="formone" action="" method="post" name="MyForm" id="login">
            <div class="title">管理员入口</div>
            <span id="message"></span>
            <div class="name"><input type="text" name="name" id="name"  v-model="name"  placeholder="请输入账号" /></div>
            <div class="password"><input type="password" name="password" id="password" v-model="password" onblur="checkMphone()"   placeholder="请输入密码" /></div>
            <div class="loginbtn">
                <button class="layui-btn" lay-submit lay-filter="login" onclick="login()">登录</button>
                <a href="/showTesterLogin">测试入口</a>
            </div>

        </form>

    </div>
</div>
</body>
<script>
    function login() {
        layui.use(['jquery','form'],function(){
            var $=layui.jquery;
            var form = layui.form;


            form.on('submit(login)', function(data){

                //提交表单数据
                $.ajax({
                    url:"/user/login",
                    type: "POST",
                    dataType:"JSON",
                    //data:data.field,
                    contentType:"application/json;charset=UTF-8",
                    data:JSON.stringify({"loginName":$("#name").val(),"password":$("#password").val()}),
                    success:function (ret) {
                        if(ret.code==0){
                            window.location.href = '/showIndex?loginName='+$("#name").val();
                        }else
                        {
                            $("#message").html(ret.msg);

                        }

                    }
                })
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        });


    }

</script>
</html>